package gov.pbc.nn.kjgl.software.handle;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.stereotype.Component;

import com.bstek.bdf2.core.business.IUser;
import com.bstek.bdf2.core.context.ContextHolder;
import com.bstek.uflo.env.Context;
import com.bstek.uflo.model.ProcessInstance;
import com.bstek.uflo.process.handler.AssignmentHandler;
import com.bstek.uflo.process.node.TaskNode;

import gov.pbc.nn.core.bdf.entity.Dept;
import gov.pbc.nn.core.utils.SecurityUtils;
import gov.pbc.nn.kjgl.Constants;

@Component("kjbm.YwgxHldAssignmentHandler")
public class YwgxHldAssignmentHandler implements AssignmentHandler {

	@Override
	public Collection<String> handle(TaskNode taskNode, ProcessInstance processInstance, Context context) {
		// TODO Auto-generated method stub
		Dept dept = (Dept) ContextHolder.getLoginUser().getDepts().get(0);
		List<String> users = new ArrayList<String>();
		List<IUser> kzUsers = SecurityUtils.getUserByRoleForDept(dept.getCDept().getId(), Constants.ROLE_CZ);
		if (kzUsers.size() > 0) {
			users.add(kzUsers.get(0).getUsername());
		}
		return users;
	}

}
